/**
 * @author caif
 * @fileoverview share view
 * @extends file viewer
 */
 App.Views.recycleView = App.Views.itemView.extend({  
     template : tpl.recycle,
     
     events: {
	    "click .inner-item": "update"
	 },
     
     initialize : function() {
 		var self = this;
     	self.constructor.__super__.initialize.apply(self);
        self.model.on('change',  self.render, self);
     },
     
     update: function(e){
     	var self = this;
        self.toggleDone(e);  
        App.viewInstances.appView.updateHeaderBtn( );
     },
     
     render: function(){
        var self = this;
        if(self.model.get('folder')){
           self.model.set({'uiSize': ''}, {silent: true});
           self.model.set({'uiExtension': App.i18n.get('folder')}, {silent: true});
        }else{
           self.model.set({'uiSize': self.getSize(self.model.get('size'))}, {silent: true});
           self.model.set({'uiExtension': self.model.get('extension')}, {silent: true});
        }
        if(self.model.get('extension')){
           self.model.set({'uiName': self.model.get('name') + '.' + self.model.get('extension')}, {silent: true});
        }else{
            self.model.set({'uiName': self.model.get('name')}, {silent: true});
        }
        self.model.set({'rootPath': App.viewInstances.appView.getRootPath()}, {silent: true});
        self.model.set({'uiUpdateTime': self.getLocaleDate(self.model.get('updateTime'))}, {silent: true});
        var jsonObj = self.model.toJSON();
	    if(self.model.get("dataBagId")){
	     jsonObj.processCommon = false;
		    self.processDatabag(self.model.get("dataBagId") , self.model.get("extension") , jsonObj , self.template);
		}else{
	        jsonObj.processCommon = true;
	        self.$el.html( Mustache.to_html(self.template ,jsonObj)); 
	    }
        self.$el.html( Mustache.to_html(self.template, jsonObj ) ); 
        self.input = self.$('.edit');
		return self;
	 }
 });
